package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.PracticeReport;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.mapper.PracticeReportMapper;
import com.ruoyi.system.service.IPracticeReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PracticeReportServiceImpl implements IPracticeReportService {

    @Autowired
    private PracticeReportMapper practiceReportMapper;

    @Override
    public List<PracticeReport> selectReportList() {
        Long userId=ShiroUtils.getSysUser().getUserId();
        if (userId==1)
            userId=null;
        return practiceReportMapper.selectReportList(userId);
    }

    @Override
    public void insertReport(PracticeReport practiceReport){
        practiceReportMapper.deleteReport(practiceReport);
        practiceReportMapper.insertReport(practiceReport);
    }
}
